<?php
//----------------------------------------------------------------------------------------------------------
    require_once('../config.inc.php');

    require_once($config['app_dir'] . '/classes/stockplot.view.php');
    require_once($config['app_dir'] . '/classes/stockplot.data.php');
    require_once($config['app_dir'] . '/classes/staff.class.php');

    require_once($config['app_dir'] . '/includes/template.class.php');
    //------------------------------------------------------------------------------------------------------
    $Staff = new objStaff($config['app_id']);
    if( !$Staff->Login()) exit;
    else {    	if( $Staff->isTrialFinished() && !$Staff->checkSubscribed() ) exit;
    }
    try {
       //---------------------------------------------------------------------------------------------------
       // checking input parameters
       //---------------------------------------------------------------------------------------------------
       $StockParams = new objStockParams();
       //---------------------------------------------------------------------------------------------------
       // preparing data for graph
       //---------------------------------------------------------------------------------------------------
       $StockModel = new objStockModel($StockParams->trade, $StockParams->start, $StockParams->finish);
       $StockModel->StrongInterval(false);
       //---------------------------------------------------------------------------------------------------
       // generating graph
        $StockView = new objStockView(635, 390);
        $StockView->HideLogo();
        $StockView->SetData($StockModel->getData());

        $StockView -> Render();
        //---------------------------------------------------------------------------------------------------
    } catch (Exception $e) {
        echo 'Error: ',  $e->getMessage(), "\n";
    }
//	} else echo 'Please Log In';
   //-------------------------------------------------------------------------------------------------------
?>
